Repository navigation
fix(dashboard): a global filter on a multi-value field is sent as $contains, not = / $in - #36181
Conversation
…tains (wip) Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…hboard Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…ing; add changeset Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…shboard-filter-arity
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Final green head · area a4-D · 2026-11-21T19:41Z |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd 席位核对 — REWORK · head 5a0b3c9One item to fix. Everything else below was checked and holds. To fix
Checked and holding
|
Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Final green head · area a4-D · round 2 · 2026-11-21T20:08Z |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd 席位核对 — ACCEPT (delta) · head 084ce1aDelta read only:
|
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd 席位核对 — correction to 7068548859 and 7068252699 (tier only)Both records said the contract review on this PR is owed at
The ACCEPT on 084ce1a is otherwise unchanged. The contract review at |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Contract reviewServed-tier: Inputs read: card #35992 (body and every comment, including the triage re-grade 7063147451, the seat's route-A note 7066557346, both claims, the file-surface amendment and the three os-dev reports), PR #36181 (body, the 13-file list, the net diff against ① Derived judgmentsEvery change to what callers can pass or to the public surface, judged against the tree at this head:
② Semver level
③ Boundary flags
Findings:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 席位核对Landing · area a4-D · 2026-11-21T20:17Z · head
Ready + auto-merge now. |
Requested by Leehom · project thread
Fixes #35992
Clause-②: yes (widening)
Metadata-protocol: none
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 — os-dev, area a4-D, route A per seat note 7066557346. The other half of this card, the condition editors, merged before this PR opened (PR #36165), so this PR closes the card.
维护者速读
What changes
A dashboard
select/lookupglobal filter bound to a field that holds several values (multiple: trueon a select, lookup or user field, or amultiselect/checkboxes/tagsfield) was sent asfield = value, or$infor several values. The server refuses both there (data door 400INVALID_FILTER; dataset door 200 with count 0). It is now sent as{ field: { $contains: value } }, and several values as$orover one$containseach.@object-ui/types—DataSource.getDataset?(datasetName, { callerPackage }): an optional read of a dataset definition. It resolvesnullwhen no dataset of that name is served, and a failed read rejects.@object-ui/data-objectstack—ObjectStackAdapter.getDatasetreadsGET /api/v1/meta/dataset/NAMEthroughclient.meta.getItem. It sends the reader's package ascallerPackage, answersnullfor the item-less envelope and for a 404, rejects on any other failure, and caches the answer per name and package.@object-ui/core—buildWidgetScopedFiltertakes an optional fifth argument: per bound field, the operators the field takes when it is stored as a JSON column. A member filter on such a field becomes$contains/$or. A member filter on a structured JSON field (json,address: nocontains) keeps=/$in, as before. New exportboundMemberFilterNames. Nothing changes for callers that do not pass the argument.@object-ui/plugin-dashboard— newfilterFieldFacts.ts. When the dashboard declares aselect/lookupfilter,DashboardRendererreads each widget's object: a dataset-bound widget'sDataset.objectthroughgetDataset, or aprovider: 'object'widget's ownobject. It then reads the object's fields throughgetObjectSchemaand gets the operators fromjsonColumnFilterOperators, the helper the list quick filter and the filter builder already use, so no second operator table exists. While the definition is in flight, a widget bound by an active member filter draws a skeleton and sends no query. When the definition cannot be read, the old=/$inlowering stays and a console warning names the filter, the source and the reason, once.content/docs/frontend/data-source.mdxdocumentsgetDataset, and the plugin-dashboard README documents the lowering.Read first, by risk:
ui/packages/plugin-dashboard/src/DashboardRenderer.tsx, the hunk aroundholdForFieldFacts. This is where a widget's query is held. A wrong condition here would hold a widget forever or send=first.ui/packages/plugin-dashboard/src/filterFieldFacts.ts,useFilterFieldFacts. The effect is keyed on joined source keys, never on an array identity (ui AGENTS.md chore: version packages #10). A source that cannot be asked answersunavailablesynchronously, so a data source withoutgetDatasetis never held.ui/packages/core/src/utils/dashboard-filters.ts,buildJsonColumnMemberClause. The$contains/$orshape.Tests
New pins (4 files, 34 tests), head 5a0b3c9
ui/packages/core/src/utils/__tests__/dashboard-filters.multiValue-35992.test.ts(12 tests): one member gives$contains; several give$or; a one-member list gives no one-arm$or; a multi-value lookup/user; an explicitfilterBindingstarget; a single-value field keeps=/$in; a text filter is unchanged; AND with other filters; no operator answer keeps=/$in; a structured JSON field keeps=/$in, explicit binding included, with no warning (round 2);boundMemberFilterNames.ui/packages/plugin-dashboard/src/__tests__/filterFieldFacts.multiValue-35992.test.ts(8 tests): real field definitions throughjsonColumnFilterOperatorscover a multiselect, a select/lookup/user withmultiple: true, and single-value select/lookup unchanged. A field the object does not declare keeps=. Covers pending and unavailable facts, and the widget source (dataset,provider: 'object'underdataand underoptions.data, inline rows).ui/packages/plugin-dashboard/src/__tests__/DashboardRenderer.multiValueFilter-35992.test.tsx(8 tests), the fixture dashboard: a global filter bound tolabels(multiselect) andteam_members(user,multiple: true). It checksruntimeFilteris$containsand that no query ever carriedlabels = frontend. The query is held behind a skeleton untilgetDatasetanswers. No hold while the filter is empty. A single-value field keeps=. With nogetDataset, or a dataset that is not served,=is kept and the filter is named in a warning. Aprovider: 'object'table gets the same$containsin itsfind$filter.ui/packages/data-objectstack/src/getDataset-35992.test.ts(6 tests, realObjectStackClientover a stubbed fetch): the route,callerPackage, the item-less envelope givesnull, a 404 givesnull, a 500 rejects with itshttpStatusandcode, one read per name.Affected suites and type-check, head 5a0b3c9
Each run was under
os-verify-lock.sh, and each result is the lock's VERDICT line.pnpm --filter @object-ui/types --filter @object-ui/core --filter @object-ui/data-objectstack --filter @object-ui/plugin-dashboard run type-check: all four printedtype-check: Done.pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-dashboard/ packages/core/src/utils/__tests__/ packages/data-objectstack/ packages/types/: Test Files 836 passed (836), Tests 15976 passed, 6 skipped (15982), VERDICT command-exit 0.@object-ui/plugin-dashboard...and@object-ui/data-objectstack...closures.Reverse verification
At 9d28642 the four source files were restored to base 146b6f9 (
dashboard-filters.ts, coreindex.ts,DashboardRenderer.tsx, data-objectstackindex.ts) with the new tests andfilterFieldFacts.tskept. Result: Test Files 4 failed (4), Tests 23 failed, 11 passed (34). The 11 that stay green are the single-value controls, the source classification and the pending/unavailable facts, which do not depend on the restored files. Restored withgit checkout HEAD -- PATH:git diff HEADwas empty, and eachgit hash-objectmatched its HEAD blob. Tests resolve@object-ui/*tosrcthrough the ui vitest alias, so no dist rebuild was involved.Live measurement, showcase (SqlDriver), fresh backend on a random port, torn down after
showcase_projecthas 5 rows. Labels were set on 3 of them:[frontend, qa],[frontend]and[qa].GET /api/v1/meta/dataset/showcase_project_metricsreturns itemobject=showcase_project. In the object definition,labelsismultiselectandteam_membersisuserwithmultiple: true. The built adapter'sgetDatasetreturnedshowcase_projectfor it, andnullfor a name that does not exist (404).POST /api/v1/analytics/dataset/query,project_count:{labels: frontend}returns 0;$in [frontend, qa]returns 0;$contains frontendreturns 2;$orof two$containsreturns 3; that$orinside an$andreturns 3.POST /api/v1/data/showcase_project/query:=and$inreturn 400INVALID_FILTER;$containsreturns 2; the$orreturns 3.Acceptance notes
$or(any of several) arm is reached only when a filter variable holds a list, as a programmatic value. It is pinned at the unit level. The rendered fixture covers the single-member case on a dataset widget and on aprovider: 'object'table.account.region) is not looked up through the relationship. The base object does not declare that name, so it keeps=/$inwith no warning. No multi-value field behind a to-one path was measured.DashboardGridLayoutwas not changed. It applies no dashboard filters today.=/$inon a JSON column with 200 and count 0 instead of refusing. That is analytics: the dataset query door answers 200 / count 0 for = or $in on a JSON (multiple) column, where the data door refuses 400 #36168's, and it is not changed here.select/lookupfilter bound to a structured JSON field (json,address, empty checks only) keeps the=/$inlowering it had before this PR, explicit bindings included. The server refuses that filter or answers it with no rows, so the widget shows no data under it. Changing that is outside this card (round 2, L1-b comment 7068252699).Verification
Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/DashboardRenderer.multiValueFilter-35992.test.tsxshould report 8 passed. Then delete thejsonColumnOperatorsFor(fieldFacts)argument inDashboardRenderer.tsxand run the file again: the$containscases fail and receive{ labels: 'frontend' }.Local gate subset, head 5a0b3c9
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 73 families from this tree. All 73 were run, and the exit codes were captured before any pipe. 72 exited 0 on the first run.pnpm --filter @objectstack/spec run check:skill-examplesexited 3 (PREREQUISITE NOT MET: client-react dist had no.d.tsafter an earlierOS_SKIP_DTS=1build of mine). After@objectstack/clientandclient-reactwere rebuilt with declarations it exited 0: 347 examples type-check.--ranreconciliation: 73 derived, 73 run, 0 NOT-MEASURED (a derived zero: all 73 recorded an exit code and none of them is 3).node ui/scripts/check-new-cross-file-line-citations.mjs: 0 new citations, exit 0.overlap-check: clean before each push. No exported symbol was renamed or deleted, so the platform checklist does not apply.Test UI,Lint UI,Type Check UI, …) is CI's.Generated by Claude Code